package LanQiaoCompetition.LanQiaoCompetition2;

public class Basic_20 {

    public static void main(String[] args) {
        String result = "";
        long n = 1234567009;
        if(n/100000000 != 0){
            result = result + function((int)n/100000000) + "yi ";
        }
        if(n/10000 != 0){
            int n2 = (int) ( (n - n/100000000*100000000)/10000 );
            result = result + function(n2) + "wan ";
        }
        int n3 = (int) (n - n/10000*10000);
        result = result + function(n3);
        System.out.println(result.substring(0,result.length()-1));
    }

    public static String function(int n){
        String result = "";
        if(n/1000 != 0){
            result = function2(n/1000) + "qian ";
        }
        if((n%1000)/100 != 0){
            result = result + function2((n%1000)/100) + "bai ";
        }
        if((n%100)/10 != 0){
            result = result + function2((n%100)/10) + "shi ";
        }
        if(n%10 != 0){
            result = result + function2(n%10);
        }
        return result;
    }

    public static String function2(int n){
        String str = "";
        switch (n){
            case 1:
                str = "yi ";
                break;
            case 2:
                str = "er ";
                break;
            case 3:
                str = "san ";
                break;
            case 4:
                str = "si ";
                break;
            case 5:
                str = "wu ";
                break;
            case 6:
                str = "liu ";
                break;
            case 7:
                str = "qi ";
                break;
            case 8:
                str = "ba ";
                break;
            case 9:
                str = "jiu ";
                break;
        }
        return str;
    }
}
